import { useModel } from "umi";

import ChooseCommodity from "../components/category/ChooseCommodities";


const useHelperCommodity = () => {
    const { setModalVisible, setModalTitle, setModalWidth, setModalComponent, setModalStyle } = useModel("global.modal");


    const openAddCommodityModal = ({ reloadData }) => {
        setModalTitle("添加商品");
        setModalVisible(true);
        setModalWidth(900);
        setModalStyle({ top: 100 });
        setModalComponent(<ChooseCommodity reloadData={reloadData} />);
    };


    return { openAddCommodityModal };
};

export default useHelperCommodity;
